package org.ccay.async.config;

import java.util.List;

import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.ParserContext;
import org.w3c.dom.Element;

/**
 * 通道配置解析器
 * 	
 * 
 * @since Dec 13, 2011
 */
public class AsyncConduitConfigParser extends MessageConfigParser {
	
	private static final String MESSAGE_CONDUITS = "conduits";
	
	/* (non-Javadoc)
	 * @see org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser#getBeanClass(org.w3c.dom.Element)
	 */
	@Override
	protected Class<?> getBeanClass(Element arg0) {
		return AsyncConduitConfig.class;
	}

	/* (non-Javadoc)
	 * @see org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser#doParse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext, org.springframework.beans.factory.support.BeanDefinitionBuilder)
	 */
	@SuppressWarnings("rawtypes")
	@Override
	protected void doParse(Element element, ParserContext ctx, BeanDefinitionBuilder bean) {
		super.doParse(element, ctx, bean);
		
		// 消息通道
		List list = ctx.getDelegate().parseListElement(element, bean.getBeanDefinition());
		bean.addPropertyValue(MESSAGE_CONDUITS, list);
	}

}
